//
//  MLMenuView.m
//  QuickCure37
//
//  Created by 马文星 on 16/6/19.
//  Copyright © 2016年 Demos. All rights reserved.
//

#import "MLMenuView.h"

@interface MLMenuView ()


@end

@implementation MLMenuView

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setupUI];
        
    }
    return self;
}


- (void)setupUI{
    
    /** 添加 */
    [self addSubview:self.menuIconView];
    [self addSubview:self.menuLab];
    
    CGFloat iconW = 60;
    CGFloat offsetY = -17;
    CGFloat offsetTop = 5;
    
    if (kDevice_Is_iPhone5) {
        
        iconW = 40;
        offsetY = -10;
        offsetTop = 2;
    }
    
    /** 约束 */
    [self.menuIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.size.mas_equalTo(CGSizeMake(iconW, iconW));
        make.centerX.mas_equalTo(self.mas_centerX);
        make.centerY.mas_equalTo(self.mas_centerY).offset(offsetY);
        
    }];
    
    [self.menuLab mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.mas_equalTo(self.menuIconView.mas_bottom).offset(offsetTop);
        make.height.mas_equalTo(30);
    }];
    
}

#pragma mark  - Lazy
-(UIImageView *)menuIconView{

    if (_menuIconView == nil) {
        _menuIconView = [[UIImageView alloc] init];
        _menuIconView.image = [UIImage imageNamed:@"gt"];
    }
    return _menuIconView;
}

- (UILabel *)menuLab{

    if (_menuLab == nil) {
        _menuLab = [[UILabel alloc] init];
        _menuLab.text = @"肿瘤";
        _menuLab.textAlignment = NSTextAlignmentCenter;
        
        
        CGFloat fontSize = 18;
        
        if (kDevice_Is_iPhone5) {
            
            fontSize = 15;
        }
        _menuLab.font = FONT(fontSize);
    }
    return _menuLab;

}

@end
